package com.server.http.handler.impl;

import com.server.conditionenum.HttpReturnStatus;
import com.server.db.DataBaseManager;
import com.server.http.handler.HttpHandler;
import com.server.http.request.HttpRequestMessage;
import com.server.http.response.HttpResponseMessage;
import com.server.mine.net.HttpProtocol;

/**
* @author	李小布
* @email	397554852@qq.com
* @version	创建时间：2018年9月26日 下午6:54:26
*/
public class SetSwitch_5 extends HttpHandler{
	@Override
	public void handle(HttpRequestMessage request, HttpResponseMessage response) {
		String msg = null;
		byte state = -1;
		long appid = 0;
		try {
			state = Byte.parseByte(request.getParameter("state"));
			appid = Long.parseLong(request.getParameter("appid"));
			msg = DataBaseManager.GetInstance().UpdateSwitch(state,"switch_5",appid);
		}catch (Exception e) {
			e.printStackTrace();
			msg = "您输入的参数有误";
		}
		if(msg == null) {
			msg = "修改成功";
			SetReturnData(response,msg,HttpProtocol.SETSWITCH5,HttpReturnStatus.Successed);
		}else {
			SetReturnData(response,msg,HttpProtocol.SETSWITCH5,HttpReturnStatus.Failed);
		}
	}
}